package com.lst.demo;

import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.view.SurfaceView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.blankj.utilcode.util.ToastUtils;
import com.lst.demo.customview.DragFrameLayout;
import com.lst.demo.recycleview.adapter.ListLvRecycleAdapter;
import com.lst.demo.recycleview.bean.PersonBean;

import java.util.ArrayList;
import java.util.List;

public class TestActivity extends AppCompatActivity {

    private ArrayAdapter mAdapter;
    private RecyclerView mRecycle;
    private DragFrameLayout dragFrameLayout;
    private ListLvRecycleAdapter lvAdapter;
    private List<PersonBean> listData;
    private ListView mList;
    private SurfaceView mSurface;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_test);
        mRecycle = findViewById(R.id.mRecycle);
        dragFrameLayout = findViewById(R.id.drag1);
        mList = findViewById(R.id.list);

        dragFrameLayout.removeAllViews();
        mSurface = new SurfaceView(this);
        mSurface.setBackgroundColor(getResources().getColor(R.color.colorAccent));
        mSurface.setZOrderOnTop(true);
        dragFrameLayout.addView(mSurface);

        mRecycle.setHasFixedSize(true);
        mRecycle.setNestedScrollingEnabled(false);
        listData = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            listData.add(new PersonBean());
        }

        lvAdapter = new ListLvRecycleAdapter(this, listData);
        mRecycle.setLayoutManager(new LinearLayoutManager(this));
        mRecycle.setAdapter(lvAdapter);


        final List<Integer> listdata = new ArrayList<Integer>();
        for (int i = 0; i < 20; i++) {
            listdata.add(i);
        }
        mAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, listdata);
        mList.setAdapter(mAdapter);
    }


    public void hangup() {
        ToastUtils.showLong("挂断");
    }

    public void jieting() {
        ToastUtils.showLong("接听");
    }

    public void cover() {
        ToastUtils.showLong("翻转");
    }

}
